package com.zm.tools.validate.core;

/**
 * 中国手机号或者固定电话 验证
 * @author zoum
 * @create 2018/6/6 15:30
 */
public class MobileValidator {

    /**
     *
     * @param s
     * @return
     */
    public static boolean validate(String s) {
        String telRegex = "^(1[34578]\\d{9})|19[89]\\d{8}|166\\d{8}$";
        String regex = "^((0\\d{2,3})-)?(\\d{7,8})$";

        if (s == null || s.length() == 0){
            return false;
        }

        if (s.matches(telRegex) || s.matches(regex)){
            return true;
        }

        return false;
    }
}
